package xddq

import (
	"fmt"
	"runtime/debug"
	"time"
	D "websocket_apn/define"
	"websocket_apn/log"
	"websocket_apn/proto"
)

const (
	KanShu_Get_Undeal_Equipment   = 0 //获取未处理的装备信息
	KanShu_Drop_Equipment         = 1 //丢弃装备
	KanShu_Replace_Equipment      = 2 //更新装备
	KanShu_Start_Cut_Tree         = 3 //开始砍树
	KanShu_Get_Undeal_Talent      = 4 //获取未处理的灵脉信息
	KanShu_Start_Stimulate_Talent = 5 //激发灵脉
)

func (xd *XdDriver) KanShuDataInit() {
	xd.UserData.XIYOUDealChan = make(chan D.EquipmentInfo, 10)
	xd.UserData.XIYOUKanChan = make(chan int, 10)

	xd.UserData.ChopDownTree.DealChan = make(chan D.EquipmentInfo, 10)
	xd.UserData.ChopDownTree.DealTalentChan = make(chan D.TalentInfo, 10)
	xd.UserData.ChopDownTree.KanChan = make(chan int, 10)
	//装备属性
	xd.UserData.ConfigAttr = [6]byte{
		//元体属性 连爆
		D.Equipment_Attribute_Combo_Sttack,
		D.Equipment_Attribute_Critical_Strike,
		//阳神属性 连反
		D.Equipment_Attribute_Combo_Sttack,
		D.Equipment_Attribute_Counter_Attack,
		//阴身属性 吞灵
		D.Equipment_Attribute_Counter_Attack,
		0,
	}
	//装备抗性
	xd.UserData.ConfigAntiAttr = [6]byte{
		//元体属性
		0,
		0,
		//阳神属性
		0,
		0,
		//D.Equipment_Attribute_Anti_Stun,         //抗击晕
		//D.Equipment_Attribute_Anti_Combo_Sttack, //抗连击
		//阴身属性
		0,
		0,

		//D.Equipment_Attribute_Anti_Stun,         //抗击晕
		//D.Equipment_Attribute_Anti_Combo_Sttack, //抗连击
	}
	/*
		R_Mythical_Talent_Xuan_Wu   = 50001 //玄武 开场3回合吸血	20 30 40 50
		R_Mythical_Talent_Bai_Fu    = 50002 //白虎 反击提高伤害	20 30 40 50
		R_Mythical_Talent_Teng_She  = 50003 //腾蛇 第一回合连击	20 30 40 50
		R_Mythical_Talent_Gou_Chen  = 50004 //勾陈 闪避后强化灵兽	 4  6  8 10
		R_Mythical_Talent_Qing_Long = 50005 //青龙 暴击后提高爆伤	12 17 22 27
		R_Mythical_Talent_Zhu_Que   = 50006 //朱雀 每回合提高击晕	 6  8 10 12
	*/
	//神兽灵脉
	xd.UserData.ConfigTalentAttr = [6]int{
		//元体属性
		D.R_Mythical_Talent_Qing_Long,
		0,
		//阳神属性
		D.R_Mythical_Talent_Teng_She,
		0,
		//阴身属性
		D.R_Mythical_Talent_Bai_Fu,
		0,
	}
}

// 切换仙魔分身
func (xd *XdDriver) SwitchClone(idx int) {
	log.Debugf("切换仙魔分身为【%s】", D.CloneName[idx])
	xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_ATTRIBUTE_SWITCH_SEPARATION_REQ, fmt.Sprintf("08%02d", idx)))
	xd.UserData.CurrentEquipmentIdx = idx
	time.Sleep(4 * time.Second)
}

// 获取当前装备属性值
func GetEquipmentCurrentAttrVal(info D.EquipmentInfo) int64 {
	for attr := D.Equipment_Attribute_Stun; attr < D.Equipment_Attribute_Blood_Suck; attr++ {
		if data, ok := info.Data2A[attr]; ok {
			return data.Litter
		}
	}
	return 0
}

// 获取当前装备抗性值
func GetEquipmentCurrentAntiAttrVal(info D.EquipmentInfo) int64 {
	for attr := D.Equipment_Attribute_Anti_Stun; attr < D.Equipment_Attribute_Anti_Blood_Suck; attr++ {
		if data, ok := info.Data2A[attr]; ok {
			return data.Litter
		}
	}
	return 0
}

// 获取装备属性值
func GetEquipmentInfoAttrVal(info D.EquipmentInfo, attr byte) int64 {
	if data, ok := info.Data2A[int(attr)]; ok {
		return data.Litter
	}
	return 0
}

// 检查装备属性
func (xd *XdDriver) CheckEquipmentInfoAttribute(idx int, info D.EquipmentInfo) bool {
	if xd.UserData.ConfigAttr[2*idx] > 0 {
		if _, ok := info.Data2A[int(xd.UserData.ConfigAttr[2*idx])]; ok {
			//判断抗性
			if xd.UserData.ConfigAntiAttr[2*idx] > 0 {
				if _, ok := info.Data2A[int(xd.UserData.ConfigAntiAttr[2*idx])]; ok {
					return true
				}
			} else if xd.UserData.ConfigAntiAttr[2*idx+1] > 0 {
				if _, ok := info.Data2A[int(xd.UserData.ConfigAntiAttr[2*idx+1])]; ok {
					return true
				}
			} else {
				return true
			}
		}
	}

	if xd.UserData.ConfigAttr[2*idx+1] > 0 {
		if _, ok := info.Data2A[int(xd.UserData.ConfigAttr[2*idx+1])]; ok {
			//判断抗性
			if xd.UserData.ConfigAntiAttr[2*idx] > 0 {
				if _, ok := info.Data2A[int(xd.UserData.ConfigAntiAttr[2*idx])]; ok {
					return true
				}
			} else if xd.UserData.ConfigAntiAttr[2*idx+1] > 0 {
				if _, ok := info.Data2A[int(xd.UserData.ConfigAntiAttr[2*idx+1])]; ok {
					return true
				}
			} else {
				return true
			}
		}
	}
	return false
}

// 检查装备品级
func (xd *XdDriver) CheckEquipmentInfoGrade(idx int, info D.EquipmentInfo) bool {
	needFlag := false
	partIdx := proto.GetEquipmentPartIdx(info.Part)
	currentInfo := xd.UserData.CurrentEquipmentInfo[idx].Equipment[partIdx]
	if currentInfo.Grade == 0 {
		log.Infof("灵脉: 未获取到[%s]的装备信息!", D.CloneName[idx])
		return false
	}
	grade := int(info.Grade) - int(currentInfo.Grade)
	level := info.Level - currentInfo.Level
	cCombatValue := xd.UserData.CurrentEquipmentInfo[idx].CombatValue
	if info.Grade > 0 {

		//星级大于当前装备直接装备
		if grade >= 0 {
			log.Infof("砍树: 装备判断[%s]更高的装备星级(+%s)! \n穿戴:%s\n当前:%s", D.CloneName[idx], D.GetCombatValueDesc(info.Combat[idx]-cCombatValue), proto.GetEquipmentInfoDesc(currentInfo), proto.GetEquipmentInfoDesc(info))
			needFlag = true
		} else if grade == -1 && level >= 10 {
			//新装备星级低于当前装备1个星级 但是等级大于当前10级以上
			log.Infof("砍树: 装备判断[%s]更高的装备等级(+%s)! \n穿戴:%s\n当前:%s", D.CloneName[idx], D.GetCombatValueDesc(info.Combat[idx]-cCombatValue), proto.GetEquipmentInfoDesc(currentInfo), proto.GetEquipmentInfoDesc(info))
			needFlag = true
		}
	}
	if needFlag {
		xd.UserData.CurrentEquipmentInfo[idx].Equipment[partIdx] = info
	}
	return needFlag
}

// 检查装备是否需要更新
func (xd *XdDriver) CheckEquipmentNeedUpdate(info D.EquipmentInfo) (int, bool) {
	needUpdateFlag := false
	idx := 0
	for idx < 3 {
		//判断装备属性
		flag := xd.CheckEquipmentInfoAttribute(idx, info)
		if !flag {
			goto checkNext
		}
		//判断妖力
		if xd.UserData.CurrentEquipmentInfo[idx].CombatValue > 0 && info.Combat[idx] < xd.UserData.CurrentEquipmentInfo[idx].CombatValue {
			goto checkNext
		}
		//判断装备星级等级
		needUpdateFlag = xd.CheckEquipmentInfoGrade(idx, info)
		if !xd.UserData.EquipmentCloneFlag || needUpdateFlag {
			break
		}
	checkNext:
		if idx == 0 {
			idx = 2
		} else if idx == 2 {
			idx = 1
		} else {
			idx = 10
		}
	}
	if idx == 10 {
		idx = 0
	}
	return idx, needUpdateFlag
}

// 更新当前装备信息
func (xd *XdDriver) CheckCurrentEquipmentInfoData(info D.CurrentEquipmentInfo) bool {
	if info.Flag {
		xd.UserData.CurrentEquipmentIdx = info.CloneIdx
		xd.UserData.FightInfo.CombatValue = info.CombatValue
		if info.CloneFlag {
			xd.UserData.EquipmentCloneFlag = true
		}
		xd.UserData.CurrentEquipmentInfo[info.CloneIdx] = info
		//首次打印分身装备信息
		if !xd.UserData.EquipmentInfoFlag[info.CloneIdx] {
			xd.UserData.EquipmentInfoFlag[info.CloneIdx] = true
			str := ""
			if info.CloneFlag {
				str = fmt.Sprintf("当前分身为【%s】", D.CloneName[info.CloneIdx])
			} else {
				str = fmt.Sprintf("当前无分身")
			}
			str += fmt.Sprintf("\t妖力%s\n", D.GetCombatValueDesc(info.CombatValue))
			str += "\t\t------详细属性------\n"
			for idx, val := range info.Attr {
				if idx == 0 || (16 < idx && idx < 21) || (28 < idx && idx < 31) || idx == 47 {
					continue
				}
				str += proto.GetEquipmentAttrDesc(idx, val)
				if idx == 4 || idx == 7 || idx == 10 || idx == 13 || idx == 16 ||
					idx == 23 || idx == 26 || idx == 29 || idx == 31 || idx == 34 ||
					idx == 37 || idx == 40 || idx == 43 || idx == 46 {
					str += "\n"
				}
			}
			str += "\t\t------当前装备------\n"
			for _, info := range info.Equipment {
				str += proto.GetEquipmentInfoDesc(info) + "\n"
			}
			log.Infof("获取信息成功: %s", str)
		}
		//如果存在仙魔分身则获取其他分身信息
		if xd.UserData.EquipmentCloneFlag {
			go func() {
				if xd.Debug {
					return
				}
				if err := xd.waitForStartSendCmd(); err != nil {
					return
				}
				for !xd.UserData.EquipmentInfoFlag[2] || !xd.UserData.EquipmentInfoFlag[1] || !xd.UserData.EquipmentInfoFlag[0] {
					if !xd.UserData.EquipmentInfoFlag[2] {
						xd.SwitchClone(2)
					} else if !xd.UserData.EquipmentInfoFlag[1] {
						xd.SwitchClone(1)
					} else if !xd.UserData.EquipmentInfoFlag[0] {
						xd.SwitchClone(0)
					}
					time.Sleep(20 * time.Second)
				}
			}()
		}
	}
	return false
}

// 砍树任务
func (xd *XdDriver) StartKanShuTask() {
	log.Debug("start StartKanShuTask thread.")
	defer func() {
		if err := recover(); err != nil {
			log.Fatalf("process:\n%s", debug.Stack())
			xd.Close()
			time.Sleep(time.Second)
		}
	}()
	//xd.UserData.ChopDownTree.KanChan <- KanShu_Get_Undeal_Equipment
	isCuting := false
	for {
		select {
		case <-xd.ctx.Done():
			{
				log.Warnf("StartKanShuTask process thread exit.")
				return
			}
			//开始砍树
		case action := <-xd.UserData.ChopDownTree.KanChan:
			{
				switch action {
				case KanShu_Get_Undeal_Equipment:
					{
						if xd.UserData.ChopDownTree.PeachNum <= 0 {
							continue
						}
						log.Debugf("砍树: 剩余桃子[%d], 获取未处理的装备信息", xd.UserData.ChopDownTree.PeachNum)
						xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_ATTRIBUTE_GET_UNDEAL_EQUIPMENT_MSG, ""))
						break
					}
				case KanShu_Start_Cut_Tree:
					{
						if xd.UserData.ChopDownTree.PeachNum > 0 && xd.UserData.ChopDownTree.ChallengeCouponNum < 6 {
							isCuting = true
							log.Debugf("砍树: 开始砍树")
							xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_ATTRIBUTE_DREAM_MSG, "08011801"))
							time.Sleep(3 * time.Second)
							xd.UserData.ChopDownTree.KanChan <- KanShu_Get_Undeal_Equipment
							isCuting = false
						} else {
							if xd.UserData.ChopDownTree.ChallengeCouponNum >= 6 {
								log.Infof("砍树: 挑战券%d已满，已停止当前任务", xd.UserData.ChopDownTree.ChallengeCouponNum)
								xd.UserData.FightInfo.ChallengeCoupon <- 1
							} else if xd.UserData.ChopDownTree.PeachNum <= 0 {
								log.Infof("砍树: 桃子数量不足，已停止当前任务")
							}
						}
						break
					}
				case KanShu_Start_Stimulate_Talent:
					{
						if xd.UserData.ChopDownTree.SpiritualGrassNum > 0 {
							log.Debugf("灵脉: 开始激发灵脉")
							xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_TALENT_RANDOM_TALENT, "0801"))
						} else {
							task := xd.GetTaskByID(proto.S_TALENT_GET_UNDEAL_TALENT_MSG)
							task.Interval = 5 * time.Minute
							log.Infof("灵脉: 先天灵草数量不足，已停止当前任务")
						}
						break
					}
				default:
					log.Debug("未知的动作")
					break
				}
			}
			//未处理的装备信息
		case equipmentInfo := <-xd.UserData.ChopDownTree.DealChan:
			{
				if !equipmentInfo.DealFlag {
					log.Debug("砍树: 无未处理的装备")
					if !isCuting {
						xd.UserData.ChopDownTree.KanChan <- KanShu_Start_Cut_Tree
					}
				} else {
					if proto.GetEquipmentPartIdx(equipmentInfo.Part) < 0 {
						log.Infof("砍树: 遇到未知部位的装备: %s", proto.GetEquipmentInfoDesc(equipmentInfo))
						break
					}
					log.Infof("砍树: 元体:%s 阳神:%s 阴身:%s %s",
						D.GetCombatValueDesc(equipmentInfo.Combat[0]-xd.UserData.CurrentEquipmentInfo[0].CombatValue),
						D.GetCombatValueDesc(equipmentInfo.Combat[1]-xd.UserData.CurrentEquipmentInfo[1].CombatValue),
						D.GetCombatValueDesc(equipmentInfo.Combat[2]-xd.UserData.CurrentEquipmentInfo[2].CombatValue),
						proto.GetEquipmentInfoDesc(equipmentInfo))
					if !xd.UserData.CurrentEquipmentInfo[xd.UserData.CurrentEquipmentIdx].Flag {
						log.Infof("砍树: 未获取到当前[%s]穿戴装备信息: %s",
							D.CloneName[xd.UserData.CurrentEquipmentIdx], proto.GetEquipmentInfoDesc(equipmentInfo))
						break
					}
					//判断是否需要更新装备
					targetEquipmentIdx, needUpdateFlag := xd.CheckEquipmentNeedUpdate(equipmentInfo)
					msg := &D.Message{}
					if !needUpdateFlag {
						log.Debugf("砍树: 丢弃当前%d级 %s-%s", equipmentInfo.Level, D.EquipmentGrade[equipmentInfo.Grade], proto.GetEquipmentPartName(equipmentInfo.Part))
						msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_ATTRIBUTE_EQUIPMENT_DEAL_MSG, fmt.Sprintf("080110%s18%02d", equipmentInfo.Id, targetEquipmentIdx))
						log.Debugf("080110%s18%02d", equipmentInfo.Id, targetEquipmentIdx)
					} else {
						if xd.checkIsAdminCount() {
							log.Infof("砍树: %s装备当前装备: %d级 %s %s", D.CloneName[targetEquipmentIdx], equipmentInfo.Level, proto.GetEquipmentPartName(equipmentInfo.Part), D.EquipmentGrade[equipmentInfo.Grade])
							msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_ATTRIBUTE_EQUIPMENT_DEAL_MSG, fmt.Sprintf("080210%s18%02d", equipmentInfo.Id, targetEquipmentIdx))
						} else {
							log.Infof("砍树: 非特殊用户,暂停砍树")
							break
						}
					}
					//time.Sleep(1 * time.Second)
					xd.Send(msg)
					xd.UserData.ChopDownTree.KanChan <- KanShu_Start_Cut_Tree
				}
			}
		//未处理的灵脉信息
		case talentInfo := <-xd.UserData.ChopDownTree.DealTalentChan:
			{
				if !talentInfo.DealFlag {
					log.Debug("灵脉: 无未处理的灵脉")
					xd.UserData.ChopDownTree.KanChan <- KanShu_Start_Stimulate_Talent
				} else {
					if proto.GetTalentPartIdx(talentInfo.Part) < 0 {
						log.Infof("灵脉: 遇到未知部位的装备: %s", proto.GetTalentInfoDesc(talentInfo))
						break
					}
					if !xd.UserData.CurrentEquipmentInfo[xd.UserData.CurrentEquipmentIdx].Flag {
						log.Infof("灵脉: 未获取到当前[%s]穿戴灵脉信息: %s",
							D.CloneName[xd.UserData.CurrentEquipmentIdx], proto.GetTalentInfoDesc(talentInfo))
						break
					}

					//判断是否需要更新装备
					targetEquipmentIdx, needUpdateFlag := xd.CheckTalentNeedUpdate(talentInfo)
					msg := &D.Message{}
					currentCombatValue := xd.UserData.CurrentEquipmentInfo[xd.UserData.CurrentEquipmentIdx].CombatValue
					if !needUpdateFlag {
						log.Debugf("%s灵脉: 妖力%s 丢弃当前%d级 %s-%s", proto.GetMythicalTalentName(talentInfo.Val), D.GetCombatValueDesc(talentInfo.CombatValue-currentCombatValue),
							talentInfo.Level, D.EquipmentGrade[talentInfo.Grade], proto.GetTalentPartName(talentInfo.Part))
						msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_TALENT_DEAL_TALENT, "08 00 10 01 20 00")
					} else {
						log.Infof("%s灵脉: 妖力%s [%s]装备当前灵脉: %d级 %s", proto.GetMythicalTalentName(talentInfo.Val),
							D.GetCombatValueDesc(talentInfo.CombatValue-currentCombatValue), D.CloneName[targetEquipmentIdx],
							talentInfo.Level, proto.GetTalentPartName(talentInfo.Part), D.EquipmentGrade[talentInfo.Grade])
						msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_TALENT_DEAL_TALENT, fmt.Sprintf("08 00 10 02 20 %d", targetEquipmentIdx))
					}
					time.Sleep(1 * time.Second)
					xd.Send(msg)
					xd.UserData.ChopDownTree.KanChan <- KanShu_Start_Stimulate_Talent
				}
			}

			//西游伏魔-开始砍树
		case action := <-xd.UserData.XIYOUKanChan:
			{
				switch action {
				case KanShu_Get_Undeal_Equipment:
					{
						if xd.UserData.XIYOUGinsengFruit <= 0 {
							continue
						}
						log.Debugf("西游伏魔: 剩余人参果[%d], 获取未处理的装备信息", xd.UserData.XIYOUGinsengFruit)
						xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_GET_UNDEAL_EQUIPMENT, fmt.Sprintf("08 %s", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID)))
						break
					}
				case KanShu_Start_Cut_Tree:
					{
						if xd.UserData.XIYOUGinsengFruit > 0 {
							isCuting = true
							cutNum := int32(1)
							if xd.UserData.XIYOULevel >= 8 {
								cutNum = 20
							} else if xd.UserData.XIYOULevel == 7 {
								cutNum = 10
							} else if xd.UserData.XIYOULevel == 6 {
								cutNum = 5
							} else if xd.UserData.XIYOULevel == 4 || xd.UserData.XIYOULevel == 5 {
								cutNum = 3
							} else if xd.UserData.XIYOULevel == 3 {
								cutNum = 2
							}
							if cutNum > xd.UserData.XIYOUGinsengFruit {
								cutNum = xd.UserData.XIYOUGinsengFruit
							}
							log.Debugf("西游伏魔: 开始消耗【%d】人参果砍树，剩余 %d", cutNum, xd.UserData.XIYOUGinsengFruit)
							for i := 0; i < 10; i++ {
								xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_ATTACK, fmt.Sprintf("08 %s 10 %02X", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID, cutNum)))
							}
							xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_RAND_EQUIPMENT, fmt.Sprintf("08 %s 10 02", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID)))
							time.Sleep(200 * time.Millisecond)
							xd.Send(proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_RAND_EQUIPMENT, fmt.Sprintf("08 %s 10 01", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID)))
							time.Sleep(200 * time.Millisecond)
							xd.UserData.XIYOUKanChan <- KanShu_Get_Undeal_Equipment
							isCuting = false
						} else {
							if xd.UserData.XIYOUGinsengFruit <= 0 {
								log.Infof("西游伏魔: 人参果数量不足，已停止当前任务")
							}
						}
						break
					}
				default:
					log.Debug("未知的动作")
					break
				}
			}
			//西游伏魔-未处理的装备信息
		case equipmentInfo := <-xd.UserData.XIYOUDealChan:
			{
				if !equipmentInfo.DealFlag {
					log.Debug("西游伏魔: 无未处理的装备")
					if !isCuting {
						xd.UserData.XIYOUKanChan <- KanShu_Start_Cut_Tree
					}
				} else {
					if proto.GetEquipmentPartIdx(equipmentInfo.Part) < 0 {
						log.Infof("西游伏魔: 遇到未知部位的装备: %s", proto.GetEquipmentInfoDesc(equipmentInfo))
						break
					}
					if xd.UserData.XIYOUCombatValue == 0 {
						log.Infof("西游伏魔: 未获取到当前妖力")
						break
					}
					//判断是否需要更新装备
					needUpdateFlag := false
					if equipmentInfo.CombatValue > xd.UserData.XIYOUCombatValue {
						needUpdateFlag = true
					}
					msg := &D.Message{}
					if !needUpdateFlag {
						log.Debugf("西游伏魔: 丢弃当前%d级 %s-%s", equipmentInfo.Level, D.EquipmentGrade[equipmentInfo.Grade], proto.GetEquipmentPartName(equipmentInfo.Part))
						msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_RESOLVE_EQUIPMENT, fmt.Sprintf("08%s10%s", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID, equipmentInfo.Id))
					} else {
						if xd.checkIsAdminCount() {
							log.Infof("西游伏魔: 装备当前装备: %d级 %s %s", equipmentInfo.Level, proto.GetEquipmentPartName(equipmentInfo.Part), D.EquipmentGrade[equipmentInfo.Grade])
							msg = proto.Get_Cmd_Data(xd.userInfo.PlayerId, proto.S_XIYOU_WEAR_EQUIPMENT, fmt.Sprintf("08%s10%s1801", xd.UserData.Activity[D.Activity_XIYOU_PLAYER_BRESS].ID, equipmentInfo.Id))
						} else {
							log.Infof("西游伏魔: 非特殊用户,暂停砍树")
							break
						}
					}
					//time.Sleep(1 * time.Second)
					xd.Send(msg)
					xd.UserData.XIYOUKanChan <- KanShu_Start_Cut_Tree
				}
			}
		}
	}
}
